home *** CD-ROM | disk | FTP | other *** search
- on workThatV12Magic
- put "V12dbe v2.0.2" & RETURN & "code last modified 10/28/97"
- put "opening the v12 xtras"
- openV12xtras()
- put "creating v12 database"
- createV12DB()
- put "opening the v12 database"
- openV12DB()
- put "importing textfile into database"
- ImportData()
- put "closing the v12 database"
- closeV12()
- end
-
- on openV12xtras
- global gDb, gTB
- openXLib(the pathName & "xtras:V12-DBE")
- openXLib(the pathName & "xtras:V12table")
- end
-
- on createV12DB
- global gDb, gTB
- set gDb to new(xtra("v12dbe"), the pathName & "ShareWare.db", "Create", "myPassword")
- if not objectp(gDb) then
- alert("Could not create the an instance of the V12dbe Xtra.")
- end if
- mCreateTable(gDb, "Table")
- if checkError() then
- halt()
- end if
- mCreateField(gDb, "Table", "section", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "category", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "name", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "filepath", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "auth/comp", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "url", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "version", "string", 300)
- checkError()
- mCreateField(gDb, "Table", "description", "string", 3000)
- checkError()
- mCreateField(gDb, "Table", "contact", "string", 1000)
- checkError()
- mCreateIndex(gDb, "Table", "categoryIndex", "duplicate", "category", "descending")
- checkError()
- mCreateFullIndex(gDb, "Table", "description")
- checkError()
- put mBuild(gDb)
- checkError()
- closeV12()
- end
-
- on openV12DB
- global gDb, gTB
- set gDb to new(xtra("v12dbe"), the pathName & "ShareWare.db", "ReadWrite", "myPassword")
- set gTB to new(xtra("v12table"), mGetRef(gDb), "Table")
- end
-
- on ImportData
- global gDb, gTB
- mImportFile(gTB, the pathName & "sharew.txt", TAB, RETURN)
- checkError()
- closeV12()
- end
-
- on checkError
- if mStatus(xtra("v12dbe")) <> 0 then
- put mError(xtra("v12dbe"))
- return 1
- end if
- return 0
- end
-
- on closeV12
- global gDb, gTB
- set gDb to 0
- set gTB to 0
- end
-